package houtai.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import houtai.mapper.UserInfoMapper;
import houtai.pojo.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserService {
    @Autowired
    private UserInfoMapper userInfoMapper;

    /**
     * MySQL查询用户信息
     *
     * @param userId 用户id
     * @return 用户信息对象
     */
    public UserInfo queryUserInfoById(Long userId) {
        // 根据userId去MySQL的tb_user_info表查询nick_name
        QueryWrapper<UserInfo> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("user_id", userId);
        return userInfoMapper.selectOne(queryWrapper);
    }
}
